/*
    微互动--网上投诉
*/
function upload(){
    var file = $('#file').val();
    var strFileName=file.replace(/^.+?\\([^\\]+?)(\.[^\.\\]*?)?$/gi,"$1");//获取文件名
    var FileExt=file.replace(/.+\./,"");//获得后缀名
    var img_validate = FileExt!='bmp'&&FileExt!='gif'&&FileExt!='jpeg'&&FileExt!='jpg'&&FileExt!='png';
    var doc_validate = FileExt!='txt'&&FileExt!='doc'&&FileExt!='xlsx'&&FileExt!='docx'&&FileExt!='xls';
    var all_validate = img_validate&&doc_validate;
    function error_info(){
        alert('请选择正确的文件格式！');
        file = '';
        $('#show_text').html('');
    }
    //文件验证成功显示文件名字
    function success_info(){
        $('#show_text').html(strFileName.substring(0,15) + '.' + FileExt);
        if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){
            $('#show_text').html(strFileName);
        }
    }
    if(all_validate){
        error_info();
        return false;
    }else{
        success_info();
    }
}

/*
    微互动--表单验证
*/
$(document).ready(function() {
    var wsts=$(".wsts_form").Validform({
        btnSubmit:"#wsts",
        label:".show_t",
        tipSweep:true,
        tiptype:function(msg,o,cssctl){
            var objtip=$(".notice");
            cssctl(objtip,o.type);
            objtip.text(msg);
        },
        beforeSubmit:function(curform){
            return false;
        }
    });
    var yjzj=$(".yjzj_form").Validform({
        btnSubmit:"#yjzj",
        tiptype:function(msg,o,cssctl){
            var objtip=$(".notice");
            cssctl(objtip,o.type);
            objtip.text(msg);
        },
        tipSweep:true,
        label:".show_t",
        beforeSubmit:function(curform){
            return false;
        }
    });
    $('form').submit(function(event) {
        if($('.notice').hasClass('Validform_wrong')){
            $('.notice').stop().slideDown(200);
        }
    });
    $('input').keydown(function(event) {
        $('.notice').stop().hide();
    });
});
